function s() {
	let li = document.querySelectorAll('#line li');
	//总价
	let all = document.querySelector('#all');
	allnum = 0;
	for(let i = 0; i < li.length; i++) {
		//单价
		var price = li[i].children[2].children[1].innerHTML;

		//数量
		var num = li[i].children[3].children[0].value;

		//小计
		var total = li[i].children[4].children[0].children[1].innerHTML = price * num;

		allnum += total;
	}
	//总价
	all.innerHTML = allnum.toFixed(2);
}
s();

//只要数量的内容发生改变，小计和总价就会更新
let num_all = document.querySelectorAll('#line li .num');
for(let j = 0; j < num_all.length; j++) {
	num_all[j].addEventListener('change', s)
}

//删除
let del = document.querySelectorAll('#line li .del');
for(let k = 0; k < del.length; k++) {
	del[k].onclick = function() {
		this.parentNode.parentNode.removeChild(this.parentNode)
		s();
	}
}